//
//  NMPOVpnResultItemCell.swift
//  NMPO
//
//  Created by PowerfullClean on 2023/10/31.
//

import UIKit

class NMPOVpnResultItemCell: UICollectionViewCell {
    override init(frame: CGRect) {
        super.init(frame: frame)
        contentView.addSubview(nmpo_bgView)
        contentView.addSubview(nmpo_iconView)
        contentView.addSubview(nmpo_titleLabel)
        contentView.addSubview(nmpo_goView)
        nmpo_bgView.snp.makeConstraints { make in
            make.left.top.width.equalToSuperview()
            make.height.equalTo(173)
        }
        nmpo_iconView.snp.makeConstraints { make in
            make.size.equalTo(48)
            make.centerX.equalToSuperview()
            make.top.equalToSuperview().offset(24)
        }
        nmpo_titleLabel.snp.makeConstraints { make in
            make.centerX.equalToSuperview()
            make.top.equalTo(nmpo_iconView.snp.bottom).offset(16)
        }
        nmpo_goView.snp.makeConstraints { make in
            make.size.equalTo(CGSize(width: 112, height: 57))
            make.top.equalTo(nmpo_bgView.snp.bottom).offset(-35)
            make.centerX.equalToSuperview()
        }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    var nmpo_funcModel: NMPOFuncModel? {
        didSet {
            guard let nmpo_funcModel = nmpo_funcModel else { return  }
            nmpo_iconView.image = UIImage(named: nmpo_funcModel.nmpo_icon)
            nmpo_titleLabel.text = nmpo_funcModel.nmpo_title
        }
    }
    lazy var nmpo_iconView: UIImageView = {
        let nmpo_iconView = UIImageView(image: UIImage(named: "nmpo_result_connectSpeed"))
        return nmpo_iconView
    }()
    lazy var nmpo_titleLabel: UILabel = {
        let nmpo_titleLabel = UILabel()
        nmpo_titleLabel.font = UIFont.systemFont(ofSize: 16)
        nmpo_titleLabel.textColor = NMPOCommon.nmpo_getHXColorValue(rgb: 0xFFFFFF)
        nmpo_titleLabel.text = "Speed test"
        return nmpo_titleLabel
    }()
    lazy var nmpo_bgView: UIImageView = {
        let nmpo_bgView = UIImageView(image: UIImage(named: "nmpo_result_connectItem"))
        return nmpo_bgView
    }()
    lazy var nmpo_goView: UIImageView = {
        let nmpo_goView = UIImageView(image: UIImage(named: "nmpo_result_connectGo"))
        return nmpo_goView
    }()
}


